package com.example.demo.utils;

import java.security.SecureRandom;

import java.util.Random;

/**
 * @version: V0.7
 * @author: 郑皓杰 吴嘉鑫
 * @className: RandomNum
 * @packageName: com.example.demo.utils
 * @description: 这是生成随机数的工具类
 * @data: 2021-07-20
 **/

public class RandomNum {
	private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
	private static final Random RANDOM = new SecureRandom();
	
	public static String getRanNum() {
		char[] chars = new char[6];	
		for (int index = 0; index < chars.length; ++index) {
			chars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
		}
		return new String(chars);
	}
}
